package exam.business.service;

import exam.common.constant.ResultPort;
import exam.common.key.KeySubQuestion;
import exam.common.util.ConvertUtils;
import exam.common.util.NullCheckUtil;
import exam.model.dao.TSubQuestionDAO;
import exam.model.entity.TSubQuestionEntity;
import exam.system.business.AbstractService;
import exam.system.business.BusinessServiceInfo;

/**
 * <p>SubQuestionGetService</p>
 * 
 * @author Phong
 * @version 20/5/2012
 */
public class SubQuestionGetService extends AbstractService {
	// tSubQuestionDAO
	private TSubQuestionDAO tSubQuestionDAO = new TSubQuestionDAO();
	@Override
	public String executeService(BusinessServiceInfo serviceInfo)
			throws Exception {
		// TODO Auto-generated method stub
		String subQuestId = serviceInfo.getString(KeySubQuestion.SUB_QUEST_ID);
		TSubQuestionEntity tSubQuestionEntity = tSubQuestionDAO
				.selectByPk(ConvertUtils.convertStringToLong(subQuestId));
		if(NullCheckUtil.isNull(tSubQuestionEntity)) {
			return ResultPort.NONE;
		}
		serviceInfo.put(KeySubQuestion.T_SUB_QUESTION_ENTITY, tSubQuestionEntity);
		return ResultPort.SUCCESS;
	}

}
